package ${package}.rss.model;

import java.util.Date;

import ${package}.commons.Utils;


/**
 *wrap com.sun.syndication.feed.synd.SyndEntry, with specific properties we
 * need.
 * 
 * @author Ke CAI
 */

public class RssEntry {

	private String title;
	private Date publishDate;
	private String sourceName;

	private String timeGap;

	private String url;
	private String urlForIndex;
	private String visitURL;

	private String description;
	private String category;
	
	private RssChannel rssChannel;

	public RssChannel getRssChannel() {
		return rssChannel;
	}

	public void setRssChannel(RssChannel rssChannel) {
		this.rssChannel = rssChannel;
	}

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public String getSourceName() {
		return sourceName;
	}

	public void setSourceName(String sourceName) {
		this.sourceName = sourceName;
	}

	public Date getPublishDate() {
		return publishDate;
	}

	public void setPublishDate(Date publishDate) {
		this.publishDate = publishDate;
	}

	/*
	 * caculate time gap use publish date.
	 */
	public String getTimeGap() {
		if (publishDate != null) {
			long publishTime = publishDate.getTime();

			// generate the timeGap
			timeGap = Utils.generateTimeGap(publishTime);
		}
		return timeGap;
	}

	public String getUrl() {
		return url;
	}

	public void setUrl(String url) {
		this.url = url;
	}

	/**
	 * Returns the archiver link, will be fetched to do index.
	 * <p>
	 * 
	 * @return String the archiver format link.
	 * 
	 */
	public String getUrlForIndex() {
		return urlForIndex;
	}

	public void setUrlForIndex(String urlForIndex) {
		this.urlForIndex = urlForIndex;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public String getCategory() {
		return category;
	}

	public void setCategory(String category) {
		this.category = category;
	}
	public String getVisitURL() {
		return visitURL;
	}

	public void setVisitURL(String visitURL) {
		this.visitURL = visitURL;
	}

}
